package com.albaba.designpattern.flyweight.text_002;

/**
 * @Description: TODO
 * @Author zx
 * @Date 2025/2/21 17:24
 * @Version 1.0
 */
public class Client {
    public static void main(String[] args) {
        GobangFactory factory = GobangFactory.getInstance();
        // 获取三颗黑子
        GobangFlyweight b1 = factory.getGobang("b");
        GobangFlyweight b2 = factory.getGobang("b");
        GobangFlyweight b3 = factory.getGobang("b");
        // 判断黑子是否是同一对象
        if (b1 == b2 && b2 == b3){
            System.out.println("黑子是同一对象");
        }else {
            System.out.println("黑子不是同一对象");
        }


        // 显示棋子
        b1.display();

    }
}
